<%--
  Created by IntelliJ IDEA.
  User: 86181
  Date: 2022/11/4
  Time: 14:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>安全库存配置单查询</title>
    <style>
        .backgroundcellno{
            color:yellow;
        }
        .backgroundcellyes{
            color:royalblue;
        }
    </style>
</head>
<body>
        <div class="container row" style="height:400px">
            <br><br>
            <br><br>
            <span style="color:green" >其中等待执行的配置单总数：<span id="nums1"></span>例</span>, 其中完成的配置单总数：<span id="nums2"></span>例
            <br><br>

            <div id="queryallcellshowtabs" class="col-lg-7 col-md-offset-2">
                <div class="input-group">
                     <span class="input-group-btn">
                    <select style="width:200px" id="cellByQueryId" class="form-control">
                        <option value="-1">-----请选择产品---</option>
                    </select>
                    </span>
                    <input type="text" class="form-control"  id="productNameCellByNames" placeholder="请输入要查询的产品">
                    <span class="input-group-btn">
                     <button class="btn btn-primary" onclick="queryallcellByname()">查询</button>
                     </span>
                </div>
            </div>
            <table id="queryallcellshow">

            </table>
        </div>
        <!--根据id查询模态框-->
        <div class="modal" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel" id="queryBYCellIdshow">
            <div class="modal-dialog modal-lg">
                <div class="modal-content">
                    < <div class="modal-header">
                    <input type="submit" class="btn btn-default" value="复核">
                    <button class="close" data-dismiss="modal">退出</button>
                </div>
                    <div class="modal-body" align="center">
                        <h2 class="modal-title">安全库存配置单</h2>
                        <div class="row" style="margin-top:30px">
                            <div class="col-md-6">
                                <table>
                                    <tr>
                                        <td>配置单编号:</td>
                                        <td><input type="text" id="storeIdzhdqq"  style="outline: none;border: none" readonly></td>
                                    </tr>
                                    <tr>
                                        <td>产品名称:</td>
                                        <td><input type="text" id="productNamezhdqq"  style="outline: none;border: none" readonly></td>
                                    </tr>
                                    <tr>
                                        <td>库存报警下线数:</td>
                                        <td><input type="text" id="minAmountzhdqq" readonly  style="outline: none;border:none;border-bottom:black 1px dashed"></td>
                                    </tr>
                                </table>
                                <br><br>
                            </div>
                            <div class="col-md-6">
                                <table>
                                    <tr>
                                        <td>产品编号:</td>
                                        <td><input type="text"  id="productIdzhdqq" style="outline: none;border: none" readonly></td>
                                    </tr>
                                    <tr>
                                        <td>库存报警上限数:</td>
                                        <td><input type="text"  id="maxAmountzhdqq" readonly style="outline: none;border:none;border-bottom:black 1px dashed"></td>
                                    </tr>
                                    <tr>
                                        <td>设计人:</td>
                                        <td><input type="text" id="registerzhdqq" required style="outline: none;border:none;border-bottom:black 1px dashed"></td>
                                    </tr>
                                </table>
                            </div>
                            <div>
                                <table class="table  table-responsive table-condensed table-bordered table-striped">
                                    <tr style="background-color: #2aabd2">
                                        <td>库房名称</td>
                                        <td>存储地址编号</td>
                                        <td>存储地址名称</td>
                                        <td>存储单元简称</td>
                                        <td>最大存储量</td>
                                        <td>存储单位</td>
                                    </tr>
                                    <tr>
                                        <td><input type="text"  value="成品库" style="outline: none;border: none;width:80px" readonly ></td>
                                        <td><input type="text"  value="01-01-01" style="outline: none;border: none;width:70px" readonly ></td>
                                        <td><input type="text"   id="stackdzhdqq" style="outline: none;border: none;width:160px " readonly ></td>
                                        <td><input type="text" value="件" style="outline: none;border:none;width:80px"></td>
                                        <td><input type="text" readonly  id="maxCapacityAmountzhdqq" style="outline: none;border:none;width:80px"></td>
                                        <td><input type="text" value="g" style="outline: none;border:none;width:80px"></td>
                                    </tr>
                                </table>
                            </div>

                            <br><br>
                            <div class="row">
                                <div class="col-md-6">
                                    <table>
                                        <tr>
                                            <td>复核人:</td>
                                            <td><input type="text" value="${username}" name="checker" readonly  style="outline: none;border:none;border-bottom:black 1px dashed"></td>
                                        </tr>
                                    </table>
                                </div>
                                <div class="col-md-6">
                                    <table>
                                        <tr>
                                            <td>登记时间:</td>
                                            <td><input type="text" name="registerTime" id="registerTimezhdqq" style="outline: none;border:none" readonly></td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                            <br><br>
                            <div>
                                <div class="form-group">
                                    <label for="message-textqq" class="control-label">配置要求:</label>
                                    <textarea class="form-control" name="config" id="message-textqq"  readonly style="width:800px;height:200px"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script>
            //加载下拉框的值
            $(function () {
                $.get("queryallcellshow.action",function (data) {
                    var datas=data.rows;
                    //赋值
                    for(var i=0;i<datas.length;i++){
                        var op=$("<option></option>")
                        op.val(datas[i].id)
                        op.text(datas[i].productName)
                        //追加到option
                        $("#cellByQueryId").append(op)
                    }
                },"json")
            })
            $("#queryallcellshow").bootstrapTable({
                url:"queryallcellshow.action",
                method:'get',                      //请求方式（*）
                contentType:"application/x-www-form-urlencoded", //如果用tomcat就要写这个
                toolbar:"#queryallcellshowtabs ",//工具按件用那个容器
                striped: true,//是否显示隔行变色
                cache: false,//是否缓存
                pagination: true,//是否显示分页
                sortable: true,//是否显示排序
                sortOrder: "aso",//排序方式
                sidePagination: "server", //分页方式：client客户端分页，server服务端分页（*）
                pageNumber: 1,//初始化加载第一页，默认第一页,并记录
                pageSize: 5,//每页记录数
                pageList: [5, 10, 15, 20],//可供选择的每页的行数（*）
                search: false,//是否显示输入框
                strictSearch: true,
                showColumns: true,//是否显示所有的列（选择显示的列）
                showRefresh: true,//是否显示刷新按钮
                minimumCountColumns: 2,//最少允许的列数
                clickToSelect: true,//是否启用点击选中行
                uniqueId:"productid",//每一行的唯一标识，一般为主键列
                showToggle: true,//是否显示详细视图和列表视图的切换按钮
                cardView: false,//是否显示详细视图
                detailView: false,//是否显示父子表
                //获取查询到的参数
                queryParams: function (params) {
                    var cellss={
                        pagesize:params.limit,
                        pageno:(params.offset/params.limit)+1,
                        sort:params.sort,
                        sortOrder:params.sort,
                        productName:$("#productNameCellByNames").val(),
                        id:$("#cellByQueryId").val()
                    }
                    return cellss;
                },
                columns:[
                    {
                        field:"storeId",
                        title:"配置单编号",
                        formatter:function (value,row,index) {
                            return "<a onclick='queryByCellIdzhdqq("+row.id+")'>"+row.storeId+"</a>"
                        }
                    },
                    {
                        field:"productId",
                        title:"产品编号",
                    },
                    {
                        field:"productName",
                        title:"产品名称",
                    },
                    {
                        field:"checkTag",
                        title:"配置单状态",
                        formatter:function (value,row,index) {
                           if(row.checkTag=='C001'){
                                return "<span style='color: #e38d13'>等待</span>";
                           }
                           if(row.checkTag=="C002"){
                               return "<span style='color: green'>完成</span>";
                           }
                            if(row.checkTag=="C003"){
                                return "<span style='color: green'>完成</span>";
                            }
                        }
                    },
                    {
                        field:"checkTag",
                        title:"复核状态",
                        formatter:function (value,row,index) {
                            if(row.checkTag=='C001'){
                                return "<span style='color: #e38d13'>等待复核</span>"
                                //this.addClass("backgroundcellyes")
                            }
                            if(row.checkTag=='C002'){

                                return "复核通过";
                                //this.addClass("backgroundcellno")
                            }
                            if(row.checkTag=='C003'){

                                return "<span style='color: green'>复核通过</span>";
                                //this.addClass("backgroundcellno")
                            }
                        }
                    }
                ]
            })
            //查询
            function queryallcellByname() {
                $("#queryallcellshow").bootstrapTable("refresh")
            }
            
            //查询
            function queryByCellIdzhdqq(id) {
                //根据账号查询产品
                $.post("queryByCellIdcheck.action/"+id,function (data) {
                    //显示模态框
                    console.log(data)
                    $("#storeIdzhdqq").val(data.storeId)
                    $("#minAmountzhdqq").val(data.minAmount)
                    $("#productNamezhdqq").val(data.productName)
                    $("#productIdzhdqq").val(data.productId);
                    $("#maxAmountzhdqq").val(data.maxAmount)
                    $("#registerzhdqq").val(data.register)
                    var firstkindname=data.firstKindName;
                    var secondkindname=data.secondKindName;
                    var thirdkindname=data.thirdKindName;

                    $("#stackdzhdqq").val(firstkindname+"-"+secondkindname+"-"+thirdkindname);
                    $("#registerTimezhdqq").val(data.registerTime)
                    $("#message-textqq").val(data.config)
                    $("#maxCapacityAmountzhdqq").val(data.maxCapacityAmount)
                },"json")
                $("#queryBYCellIdshow").modal("show")
            }

        </script>
</body>
</html>
